/*
 *  AMPLogDataRecord.h
 *  AMPlugin
 *
 *  Created by Toan on 7/6/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */
#include <iostream>
#include <string>
#include <time.h>
#include "PMString.h"
using namespace std;

struct AMPLogDataRecordHeader {

	// Time save
	int32	DateYear;					// System Year:
	int32	DateMonth;					// Month:
	int32	DateDay;					// Date:
	
	int32 TimeHour;						// hour
	int32 TimeMinute;					// minute
	
	//int32 g_Magazine_Count;				// Total magazine count :

	string g_SDK_WorkspaceDir;			// Directory AM Plugin :
	string g_System_WorkspaceDir;		// System Directory AM Plugin :
	string g_Domain;					// Current domain work :
	//string g_Username;					// Username :
	
	//bool g_IsLoggedIn;					// Is system Log in :
	bool g_IsCheckOut;					// Is systen Check out :
	bool g_ShouldDownload;				// Should download :
	
	//bool g_TextSelected;				// Text now selected :
	//string g_SelectedTextFrameUID;		// Selected Text Frame UID :
	
	int32 g_TextFrameCount;				// Text Frame Count :

	string g_Magazineid;				// Current magazine ID :
	string g_Issueid;					// Current Issue ID :
	string g_Pageid;					// Current Page ID :
	string g_Storyid;					// Current Story ID :
	string g_IDMLzip;					// Current IDML zip ID :
	string g_Package_id;				// Current package ID :
	string g_DocName;					// Current document name :
	string g_IDMLOpen;					// Current IDML open ID :
	bool g_ShouldUpdateDocName;			// Should Upload Document Name :
	bool g_IsIssueEnable;				// Issue Setting :
	
	string n_mSessionConnection;		// Session connection :
	string n_mSessionID;				// Session id :
	int32  n_mSessionTimeOut;			// Session time out :
	string n_mSessionUserID;			// Session user id :
	int32  n_mSessionCounterReset;		// Session Counter Reset :
	int32  n_mSessionTotalCounterReset;	// Session Total Counter Reset :
	
	string g_TextFrames;				// Text frames :
};

bool LogHeaderFileSave(AMPLogDataRecordHeader* pHeader );
bool LogHeaderFileClear(AMPLogDataRecordHeader* pHeader);
bool LogHeaderFileSetValue(AMPLogDataRecordHeader* pHeader);
bool LogHeaderFileLoad(AMPLogDataRecordHeader* pHeader);
void LogHeaderFileDebug(AMPLogDataRecordHeader* pHeader);
bool LogHeaderFileInitValue(AMPLogDataRecordHeader* pHeader);
int InitLogHeaderFile();
int SaveLogHeaderFile();
int LoadLogHeaderFile();
bool ResetGlobalValue();
int SaveSessionInfo();
string LoadSessionInfo();

bool SaveSettingInfo();
bool LoadSettingInfo();

bool SaveStoriesMap();
bool SaveImagesMap();
bool SaveLinksMap();
bool SaveLogCenterData(string _content);
void InitLogCenter(bool EnableClear = FALSE);